package main

import "fmt"

func main0801() {
	var i interface{}
	i = 10
	value, ok := i.(int)
	if ok {
		fmt.Println("整型数据：", value+10)
	} else {
		fmt.Println("错误")
	}
}

func demo() {
	fmt.Println("hello world")
}

func main0802() {
	var i []interface{}
	i = append(i, 10, 3.14, "宇智波斑", demo)
	for _, v := range i {
		//fmt.Println(idx, v)
		if data,ok := v.(int); ok{
			fmt.Println("整型数据：",data)
		} else if data, ok := v.(float64); ok {
			fmt.Println("浮点数据：",data)
		}else if data,ok := v.(string); ok {
			fmt.Println("字符串数据：",data)
		} else if data,ok := v.(func()); ok {
			data()
		}
	}
}
